package com.emep.changzhi.analyse.http.statistics;

import com.emep.changzhi.analyse.model.ResultBean;
import com.emep.changzhi.analyse.service.statistics.GetDayPositionNameService;
import com.emep.changzhi.analyse.utils.Constant;
import com.emep.changzhi.analyse.utils.DataValidator;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("stat")
@Api(value="api管控服务",tags={"查询国控站点48小时服务操作接口"})

public class GetDayPositionNameController {



        @Autowired
        private GetDayPositionNameService getDayPositionNameService;


        @ApiOperation(value = "根据污染物查询国控站点", notes = "根据起始时间和污染物名称来获取国控站点信息")
        @ApiResponses({@ApiResponse(code = 1, message = "操作成功"),
                @ApiResponse(code = 0, message = "操作失败，服务器内部异常"),
                @ApiResponse(code = 303, message = "权限不足")})

        @GetMapping(value = "pollution/site")
        public ResultBean<Map<String, Object>> findapiByTime(@RequestParam Map<String, Object> payload) {
            ResultBean result = DataValidator.validateMapData(payload);
            if (result.getCode() == Constant.RESULT_CODE_SUCCESS) {
                return result.ok(getDayPositionNameService.findapiByTime(payload));
            }

            return result;
        }
    }

